Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 vector-feature-night-mode-enabled skin-theme-clientpref-os vector-sticky-header-enabled" lang="fr" dir="ltr"><head>
<meta charset="UTF-8">
<title>Script shell</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./_res_/favicon.png">
<link rel="canonical" href="https://fr.wikipedia.org/wiki/Script_shell"> <link href="./_mw_/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
<link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
<link rel="stylesheet" type="text/css" href="./_res_/footer.css">
<link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Script_shell rootpage-Script_shell skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Script shell</span></h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="contentSub">
<div id="mw-content-subtitle"></div>
</div>
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="fr" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="fr" dir="ltr">
<p>Un <b><span class="lang-en" lang="en">script shell</span></b> est un <a href="Programme_informatique" title="Programme informatique">programme informatique</a> développé pour fonctionner dans un <a href="Interpr%C3%A9teur_de_commandes" title="Interpréteur de commandes">interpréteur de commandes</a> <a href="Shell_Unix" title="Shell Unix">shell Unix</a><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>. Il utilise des <a href="Commandes_Unix" title="Commandes Unix">commandes de terminal</a> comme code. Un <span class="lang-en" lang="en">shell script</span> est un fichier finissant avec l'extension <code>.sh</code>.
</p><p>Le terme est aussi utilisé de façon plus large pour désigner l'utilisation automatisée d'une <a href="Interface_syst%C3%A8me" title="Interface système">interface système</a> (<i><span class="lang-en" lang="en">shell</span></i>)&nbsp;; chaque système d'exploitation utilise une dénomination particulière pour ces fonctions notamment <a href=".bat" title=".bat"><i><span class="lang-en" lang="en">batch files</span></i></a> (pour <a href="MS-DOS" title="MS-DOS">MS-DOS</a>-<a href="Windows_95" title="Windows 95">Win95</a>, <a href="OS/2" title="OS/2">OS/2</a>), <i><span class="lang-en" lang="en">procedure commands</span></i> (VMS) et scripts shell.
</p><p>Les <span class="lang-en" lang="en">shells</span> les plus courants pour les systèmes Unix ou <a href="Type_Unix" title="Type Unix">type Unix</a> sont le <a href="Korn_shell" title="Korn shell">Korn shell</a> (ksh), le <a href="Bourne_shell" title="Bourne shell">Bourne shell</a> (bsh) et <a href="Bourne-Again_shell" title="Bourne-Again shell">Bourne-Again shell</a> (bash). Mêle pour des systèmes ayant un shell différent, tel que <a href="Zsh" class="mw-redirect" title="Zsh">Zsh</a> sur <a href="MacOS" title="MacOS">macOS</a>, ces <span class="lang-en" lang="en">shells</span> sont présents pour assurer la <a href="Compatibilit%C3%A9_ascendante_et_descendante" title="Compatibilité ascendante et descendante">rétro-compatibilité</a><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Histoire">Histoire</h2></div>
<p>Le <span class="lang-en" lang="en">shell script</span> a été créé en même temps que l'<a href="Interpr%C3%A9teur_de_commandes" title="Interpréteur de commandes">Interpréteur de commandes</a> <a href="Bourne_shell" title="Bourne shell">BSH</a> en 1977. Il était conçu pour exécuter plusieurs commandes plus rapidement et simplement.
</p>
<div class="mw-heading mw-heading2"><h2 id="Exemple">Exemple</h2></div>
<div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span><span class="nb">echo</span><span class="w"> </span><span class="s2">"Hello World"</span>
<span class="nb">read</span><span class="w"> </span>-p<span class="w"> </span><span class="s2">"Quel est votre nom&nbsp;?"</span><span class="w"> </span>name
<span class="nb">echo</span><span class="w"> </span><span class="s2">"Votre nom est </span><span class="nv">$name</span><span class="s2">"</span>
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="Notes_et_références"><span id="Notes_et_r.C3.A9f.C3.A9rences"></span>Notes et références</h2></div>
<div class="references-small decimal" style=""><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a> </span><span class="reference-text"><span class="ouvrage" id="KernighanPike1984"><span class="ouvrage" id="Brian_W._KernighanRob_Pike1984"><a href="Brian_Kernighan" title="Brian Kernighan">Brian W. <span class="nom_auteur">Kernighan</span></a> et Rob <span class="nom_auteur">Pike</span>, <cite class="italique">The UNIX Programming Environment</cite>, Prentice Hall, Inc., <time>1984</time> <small style="line-height:1em;">(<a href="International_Standard_Book_Number" title="International Standard Book Number">ISBN</a>&nbsp;<span class="nowrap">0-13-937699-2</span>)</small>, «&nbsp;3. Using the Shell&nbsp;», <abbr class="abbr" title="page">p.</abbr>&nbsp;94<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=The+UNIX+Programming+Environment&amp;rft.pub=Prentice+Hall%2C+Inc.&amp;rft.aulast=Kernighan&amp;rft.aufirst=Brian+W.&amp;rft.au=Pike%2C+Rob&amp;rft.date=1984&amp;rft.pages=94&amp;rft.isbn=0-13-937699-2&amp;rfr_id=info%3Asid%2Ffr.wikipedia.org%3AScript+shell"></span></span></span>&nbsp;:<blockquote><p>«&nbsp;The shell is actually a programming language: it has variables, loops, decision-making, and so on.&nbsp;»</p></blockquote></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a> </span><span class="reference-text"><span class="ouvrage" id="Robbins_and_Nelson_H.F._Beebe2005"><span class="ouvrage" id="Arnold_Robbins_and_Nelson_H.F._Beebe2005">Arnold Robbins and Nelson H.F. Beebe, <cite class="italique">Classic Shell Scripting</cite>, O'Reilly Media, <time>2005</time> <small style="line-height:1em;">(<a href="International_Standard_Book_Number" title="International Standard Book Number">ISBN</a>&nbsp;<span class="nowrap">978-0-596-00595-5</span>)</small>, <abbr class="abbr" title="page">p.</abbr>&nbsp;5<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Classic+Shell+Scripting&amp;rft.pub=O%27Reilly+Media&amp;rft.au=Arnold+Robbins+and+Nelson+H.F.+Beebe&amp;rft.date=2005&amp;rft.pages=5&amp;rft.isbn=978-0-596-00595-5&amp;rfr_id=info%3Asid%2Ffr.wikipedia.org%3AScript+shell"></span></span></span></span>
</li>
</ol></div>
</div>
<ul id="bandeau-portail" class="bandeau-portail"><li><span class="bandeau-portail-element"><span class="bandeau-portail-icone"><span class="noviewer" typeof="mw:File"></span></span> <span class="bandeau-portail-texte">Portail de la programmation informatique</span> </span></li> </ul></div><!--htdig_noindex--><div><div class="zim-footer">
Cet article est issu de <a class="external text" title="Dernière modification le 2025-07-31" href="https://fr.wikipedia.org/wiki/?title=Script_shell&amp;oldid=227750176">Wikipédia</a>. Sauf mention contraire, le texte est disponible sous <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.fr">Creative Commons Attribution-Share Alike 4.0</a>. Des conditions supplémentaires peuvent s’appliquer aux fichiers multimédias.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
<script src="./_webp_/webpHandler.js"></script>

</body></html>